<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/6/29 13:40
 * Modified Time: 2019/6/29 13:40
 * Version: 2.0
 */

namespace App\Modules\Activity\Validators;


use Flower\Core\Repository\Contracts\ValidatorInterface;
use Flower\Core\Repository\Validator\LaravelValidator;

class ActivityValidator extends LaravelValidator
{
    protected $rules = [
        ValidatorInterface::RULE_CREATE => [
            'store_id' => 'required|numeric',
            'title' => 'required|between:2,20',
            'playbill' => 'numeric',
            'content' => 'required|between:2,200',
            'expire' => 'required',
        ],
        ValidatorInterface::RULE_UPDATE => [
            'title' => 'filled|between:2,20',
            'playbill' => 'numeric',
            'content' => 'filled|between:2,200',
            'expire' => 'filled',
        ]
    ];
    protected $messages = [
        'store_id.required' => '店铺id不能为空',
        'store_id.numeric' => '店铺id格式错误',

        'title.required' => '请填写公告标题',
        'title.between' => '公告标题应在2-20个字符之间',

        'title.filled' => '请填写公告标题',

        'playbill.required' => '公告图片错误',

        'content.required' => '请填写公告内容',
        'content.between' => '公告内容应在2-20个字符之间',

        'expire.required' => '请选择过期时间',
    ];
}